-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Support for Microsoft Busystatus #1220
base: master
Are you sure you want to change the base?
Conversation
this should close pull request #989 as well... |
I'm using this with davmail. However, I just found out, that it only displays the status correctly, and the update only sometimes works - due to davmail doing some processing on their end as well. So if this should be fully supported, a patched version of davmail is required as well... For displaying it works well though |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't had a chance to properly test this yet, but overall seems to look okay.
return {'BUSY': 'Busy', | ||
'FREE': 'Free', | ||
'TENTATIVE': 'Tentative', | ||
'WORKINGELSEWHERE': 'Work elsewhere', | ||
'OOF': 'Out of office'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to define this dictionary inside a function, just make it a global dictionary. Otherwise it gets recreated each time the function is called, which is kinda pointless.
if 'X-MICROSOFT-CDO-BUSYSTATUS' not in self._vevents[self.ref]: | ||
return 'BUSY' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this property is not set, I don't think we should fall back to BUSY
, we should return None
instead. Especially since this property is non-standard.
if 'X-MICROSOFT-CDO-BUSYSTATUS' not in self._vevents[self.ref]: | ||
return '' | ||
busystatus = self._vevents[self.ref]['X-MICROSOFT-CDO-BUSYSTATUS'] | ||
if busystatus not in self.allowed_busystatus.keys(): | ||
return '' | ||
return self.allowed_busystatus[busystatus] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non blocking hint: You can use self._vevents[self.ref].get('X-MICROSOFT-CDO-BUSYSTATUS', None)
, which returns the value (if present) or None
(if absent).
if 'X-MICROSOFT-CDO-BUSYSTATUS' not in self._vevents[self.ref]: | |
return '' | |
busystatus = self._vevents[self.ref]['X-MICROSOFT-CDO-BUSYSTATUS'] | |
if busystatus not in self.allowed_busystatus.keys(): | |
return '' | |
return self.allowed_busystatus[busystatus] | |
busystatus = self._vevents[self.ref].get('X-MICROSOFT-CDO-BUSYSTATUS', None) | |
if busystatus not in self.allowed_busystatus.keys(): | |
return '' | |
return self.allowed_busystatus[busystatus] |
Which can be further simplified into:
if 'X-MICROSOFT-CDO-BUSYSTATUS' not in self._vevents[self.ref]: | |
return '' | |
busystatus = self._vevents[self.ref]['X-MICROSOFT-CDO-BUSYSTATUS'] | |
if busystatus not in self.allowed_busystatus.keys(): | |
return '' | |
return self.allowed_busystatus[busystatus] | |
busystatus = self._vevents[self.ref].get('X-MICROSOFT-CDO-BUSYSTATUS', None) | |
return self.allowed_busystatus.get(busystatus, ""): |
Any idea what they're doing? |
Yes, they seem to do the following: on update: on event creation:
I'm currently thinking there are two options: only supprort setting the status to Busy / Free / Tentative (as it seems to be the standard) and only display the MS-Status for events that have been added externally or modify davmail. I'm leaning towards the first option, since the latter would most likely lead to problems with other clients (like Dav5x) when they do not follow the MS standard. |
Thanks for all the feedback, I will update it =) |
I added support for the ics Attribute X-MICROSOFT-BUSYSTATUS. Since this is my fist contribution to the ikhal project, I would greatly appreciate feedback on this one.
Kind regards,
Sebastian